package leetcode;

import java.util.List;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-10-26 13:04
 **/
public class LeetCode429 {

    /*public List<List<Integer>> levelOrder(Node root) {
        List<List<Integer>> list = new ArrayList<>();
        if (root == null) {
            return list;
        }
        Deque<Node> deque = new LinkedList<>();
        deque.offer(root);
        //存储每一层的节点值
        List<Integer> list2 = null;
        //用来存储临时节点
        Node temp = null;
        while (!deque.isEmpty()) {
            list2 = new ArrayList<>();
            //存储当前层节点个数
            int size = deque.size();
            for (int i = 0; i < size; i++) {
                temp = deque.poll();
                list2.add(temp.val);
                //将一层的所有节点加入到队列中
                deque.addAll(temp.children);
            }
            list.add(list2);
        }
        return list;
    }*/

}

/*class Node {
    public int val;
    public List<Node> children;

    public Node() {}

    public Node(int _val) {
        val = _val;
    }

    public Node(int _val, List<Node> _children) {
        val = _val;
        children = _children;
    }
}*/
